const express = require("express")
const articlehandler = require("../router_handler/articlehandler")
// 导入验证数据的中间件
const expressJoi = require("@escook/express-joi")
// 导入文章分类的验证模块
const { add_cate_schema, delete_cate_schema } = require("../schema/article")

const router = express.Router()
//查询文章分类获取所有
router.get("/cates", articlehandler.getArticleCates)

// 新增文章分类的路由
router.post(
  "/addcates",
  expressJoi(add_cate_schema),
  articlehandler.addArticleCates
)

// 删除文章分类的路由，根据id删除
router.get(
  "/deletecate/:id",
  expressJoi(delete_cate_schema),
  articlehandler.deleteCateById
)

module.exports = router
